<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName()
			+ ":" + request.getServerPort() + request.getContextPath();
%>
<jsp:include page="/WEB-INF/page/auth/_header.jsp"></jsp:include>
<body>
	<jsp:include page="/WEB-INF/page/auth/header.jsp"></jsp:include>
	<div id="middle">
		<jsp:include page="/WEB-INF/page/auth/menu.jsp"></jsp:include>
		<div id="right">
		    <table id="course_class_datedg">
		        <thead>
		            <tr>
		            	<th data-options="field:'id',checkbox:true"></th>
		            	 <th data-options="field:'classDate',title:'上课时间',width:40,
		                editor:{
		            		type:'combobox',
							options: {  
			                    data: [{'value': '周一'},{'value': '周二'},{'value': '周三'},{'value': '周四'},{'value': '周五'}],
			                    valueField: 'value',  
                    			textField: 'value',  
			                    mode:'remote',
								multiple:true,
								editable:false,
								required:true
			                } 
		            	}"></th>
		            </tr>
		        </thead>
		    </table>
		</div>
	</div>
	<jsp:include page="/WEB-INF/page/auth/_footer.jsp"/>
	<script src="<%=basePath %>/js/datagrid-helper.js" type="text/javascript"></script>
	<script type="text/javascript">
        $(function(){
            var url = basePath + "/sys/course/classDateConf";
            loadDatagrid("course_class_date", url);
        })
        function loadDatagrid(cf, url){
        	dgEditIndex[cf]=-1;
        	var btnArr=[];
        	btnArr.push({text:'修改',iconCls:'icon-edit',handler:function(){modify(cf)}},'-');
        	btnArr.push({text:'保存',iconCls:'icon-save',handler:function(){save(cf)}},'-');
        	btnArr.push({text:'取消',iconCls:'icon-undo',handler:function(){undo(cf)}});	
			$("#"+cf+"dg").datagrid({
				url: url + "/pageQuery",
				rownumbers:true,
				striped:true,
				border:false,
				pagination:false,
				pageSize:30,
				fitColumns:true,
				singleSelect: true,
				fit: true,
				toolbar: btnArr,
				onAfterEdit: function(rowIndex,rowData,changes){
			    	if($.isEmptyObject(changes)) {
			    		var dgObj=$('#'+cf+'dg');
						dgObj.datagrid('rejectChanges');
						dgEditIndex[cf]=-1;
						return;	
					}
					changes.id = rowData.id;
			    	addmodify(changes, cf, url)
			    }
			})
		}
    </script>
</body>
</html>